/*
 * This filter converts Feet to Meters in the Altitude frame
 * @author Team 10
 */
public class AltitudeFilter extends FilterFramework2
{
	public AltitudeFilter() 
	{
		// this filter has one input and one output port
		super(1, 1);
	}

	public void run()
    {
		while (true)
		{
			try
			{
				// This measurement will aid with extracting and setting specific data within
				// an entire Data Frame
				Measurement measurement = new Measurement();
				
				// read bytes from Pipe 0
				measurement.readByteStream(this, 0);

				// grab the Altitude value from the dataframe
				Double alt = (Double)measurement.getValue(2);
				
				// Convert from feet to meters
				alt = alt*0.3048;
				
				// save the value back into the dataframe
				measurement.setValue(2, alt);
				
				// write the cleaned data frame to the pipe
				measurement.writeByteStream(this, 0);
			} // try
			catch (EndOfStreamException e)
			{
				System.out.print( "\n" + this.getName() + "::Middle Exiting;" );
				break;

			} // catch

		} // while

   } // run
}
